<?php
/*-----------------------------------------------------------------
* 	ID:						cseov241_qf3.php
* 	Letzter Stand:			v2.2 R365
* 	zuletzt geaendert von:	akausch
* 	Datum:					2012/07/03
*
* 	Copyright (c) since 2010 commerce:SEO by Webdesign Erfurt
* 	http://www.commerce-seo.de
* ------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
* 	Released under the GNU General Public License
* ---------------------------------------------------------------*/

  class cseov241_qf3 {
    var $title, $output;

    function cseov241_qf3() {
      $this->code = 'cseov241_qf3';
      $this->version = '2.4.3';
      $this->title = 'cseov241_qf3';
      $this->description = 'Fix 3 für commerce:SEO v2next';
      $this->enabled = ((MODULE_CSEO_V241QF3_STATUS == 'true') ? true : false);
      $this->sort_order = MODULE_CSEO_V241QF3_SORT_ORDER;

      $this->output = array();
    }

    function process() {
      global $order, $xtPrice;


    }

    function check() {
      if (!isset($this->_check)) {
        $check_query = xtc_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_CSEO_V241QF3_STATUS'");
        $this->_check = xtc_db_num_rows($check_query);
      }

      return $this->_check;
    }

    function keys() {
		return array('MODULE_CSEO_V241QF3_STATUS', 'MODULE_CSEO_V241QF3_SORT_ORDER');
    }

    function install() {
		xtc_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_key, configuration_value,configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_CSEO_V241QF3_STATUS', 'true', '6', '1','', now())");
		xtc_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_key, configuration_value,configuration_group_id, sort_order, date_added) VALUES ('MODULE_CSEO_V241QF3_SORT_ORDER', '1','6', '2', now())");
		xtc_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_key, configuration_value,configuration_group_id, sort_order, date_added) VALUES ('MODULE_CSEO_V241QF3', 'true','6', '3', now())");
	
		@xtc_db_query("ALTER TABLE attr_profile ADD attributes_vpe_status INT( 1 ) NOT NULL DEFAULT '0',
					ADD attributes_vpe INT( 11 ) NOT NULL ,
					ADD attributes_vpe_value DECIMAL( 15, 4 ) NOT NULL ;");
		@xtc_db_query("ALTER TABLE orders_pdf_profile CHANGE pdf_value pdf_value TEXT;");
		@xtc_db_query("ALTER TABLE admin_access ADD cseo_logo INT( 1 ) NOT NULL DEFAULT '0';");
		@xtc_db_query("UPDATE admin_access SET cseo_logo = 1 WHERE module_export = 1;");
		@xtc_db_query("INSERT INTO admin_navigation VALUES(NULL, 'cseo_logo', 'Logo Manager', 'seo_config', 'cseo_logo.php', NULL, 2, NULL, 11);");
		@xtc_db_query("INSERT INTO admin_navigation VALUES(NULL, 'cseo_logo', 'Logo Manager', 'seo_config', 'cseo_logo.php', NULL, 1, NULL, 11);");
		@xtc_db_query("ALTER TABLE products CHANGE products_g_identifier products_g_identifier VARCHAR( 128 ) NULL DEFAULT  'TRUE';");
		@xtc_db_query("INSERT INTO configuration VALUES (NULL, 'CUSTOMER_CID_FORM', 'date', 5, 8, NULL, NOW(), NULL, \"xtc_cfg_select_option(array('date', 'custom', 'num'),\");");
		@xtc_db_query("INSERT INTO configuration VALUES (NULL, 'CUSTOMER_CID_FORM_CUSTOM', '', 5, 9, NULL, NOW(), NULL, '');");
		@xtc_db_query("UPDATE configuration SET configuration_group_id  =  '5', sort_order =  '10' WHERE configuration_key = 'TRUSTED_SHOP_CREATE_ACCOUNT_DS';");
		@xtc_db_query("INSERT INTO commerce_seo_url_names (id, file_name, file_name_php) VALUES (NULL , 'FILENAME_BLOG', 'blog.php');");

		xtc_db_query("UPDATE database_version SET version = 'commerce:SEO v2next 2.4.3'");
		@xtc_db_query("CREATE TABLE IF NOT EXISTS intrusions (
					  name varchar(128) NOT NULL,
					  badvalue varchar(255) NOT NULL,
					  page varchar(255) NOT NULL,
					  tags varchar(255) NOT NULL,
					  ip varchar(128) NOT NULL,
					  ip2 varchar(128) NOT NULL,
					  impact varchar(255) NOT NULL,
					  origin varchar(255) NOT NULL,
					  created date NOT NULL
					);");
		
	
    }

    function remove() {
      xtc_db_query("DELETE FROM " . TABLE_CONFIGURATION . " WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
      xtc_db_query("DELETE FROM " . TABLE_CONFIGURATION . " WHERE configuration_key = 'MODULE_CSEO_V241QF3'");
    }

  }
?>